package com.woniuxy.consumer.student.feignClients;

import com.woniuxy.common.DTO.ResponseResult;
import com.woniuxy.common.entity.Student;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: linKe
 * @Date: 2022/1/21 10:10
 * @FileName: StudentOpenfeign
 * @version: 1.0
 * @Description: 定义接口，声明服务的调用哪个
 * ·@FeignClient("provider-student")    指定调用的服务名字
 *
 * 接口中定义的方法，就是要调用的8081中的方法的请求路径
 *
 * ·@RequestMapping("/student") 对应的controller 路劲
 *  fallback 指定降级处理类
 *
 *  直接启动报错   将request路径注解放在具体的方法上
 */
///@FeignClient(name="provider-student",fallback = StudentOpenfeignFallback.class)
@FeignClient(name="provider-student")
///@RequestMapping("/student")
public interface StudentOpenfeign {


    @GetMapping("/student/{id}")
    public ResponseResult<Student> getStudentById(@PathVariable("id")int id);

    @PutMapping("/student")
    public ResponseResult<?> updateStudent(@RequestBody Student student) ;

    @PostMapping("/student")
    public ResponseResult<?> addStudent(@RequestBody Student student);

    @DeleteMapping("/student/{id}")
    public ResponseResult<?> deleteStudent(@PathVariable("id") int id) ;

    @GetMapping("/student/")
    public ResponseResult<List<Student>> getStudent() ;

    @GetMapping("/student/timeout")
    public ResponseResult<?> timeout() ;


    @GetMapping("/student/ok")
    public ResponseResult<?> ok();

}
